home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / qbtools1.arc / AEBITPRV.BAS < prev    next >
BASIC Source File  |  1987-01-21  |  1KB  |  63 lines

  1. rem $linesize:132
  2. rem $title:'Application Engineer Standard Routines'
  3. rem $subtitle:'Find the PREVIOUS key in lexical sequence'
  4. '
  5. '  bit.prev finds the previous key to the currently selected one.
  6. '
  7. '  amend it to just loop on the end.   21-Jan-86
  8. '
  9. '                Include the COMMON values
  10. rem $include:'AESHARED.BAS'            
  11.     
  12. sub bit.prev(fl%,ky$,mrec%,success%) static
  13.  
  14.         pmrec%=mrec%
  15.         psuccess%=success%
  16.         pky$=ky$
  17.  
  18.         if success%=0 then
  19.             goto noprev
  20.         end if
  21.         get #fl%,success%
  22.         ky$=xk$(fl%,1)
  23.         lft%=cvi(xk$(fl%,2))
  24.         if lft%=0 then
  25.             goto phead
  26.         end if
  27.         success%=lft%
  28. prnxt:
  29.         get #fl%,success%
  30.         rgt%=cvi(xk$(fl%,3))
  31.         if rgt%=0 then
  32.             goto pread
  33.         end if
  34.         success%=rgt%
  35.         goto prnxt
  36. phead:
  37.         success%=cvi(xk$(fl%,4))
  38.         if success%=0 then
  39.             goto noprev
  40.         end if
  41.         get #fl%,success%
  42.         if ky$=>xk$(fl%,1) then
  43.             goto pread
  44.         end if
  45.         goto phead
  46. pread:
  47.         ky$=xk$(fl%,1)
  48.         mrec%=cvi(xk$(fl%,5))
  49.         goto pfin
  50. noprev:
  51.         mrec%=0
  52.         success%=0
  53.         ky$=""
  54. pfin:
  55.         if mrec%=0% or success%=0% then
  56.             if pmrec%>0% and psuccess%>0% then
  57.                 mrec%=pmrec%
  58.                 success%=psuccess%
  59.                 ky$=pky$
  60.             end if
  61.         end if
  62.     end sub
  63.